export default {
	/**
	 * 返回，相当于点APP左上角的返回按钮
	 */
	bk_back() {
		if (window.BKBridge) {
			window.BKBridge.Call('go_back', {
					'data': "",
					'backLevel': 1
				},
				'');
		} else {
			window.history.back(-1);
		}
	},
	/**
	 * 修改APP导航上的标题
	 * @param title  标题
	 */
	bk_set_nav_title(title) {
		if (window.BKBridge) {
			window.BKBridge.Call('bk_set_nav_title', {
					'title': title
				},
				'');
		} else {
			document.title = title;
		}
	},
	/**
	 * 用新的页面打开一个网页
	 * @param url    必填，网页的完成地址，带http的
	 * @param title  可选，APP导航上的标题
	 */
	bk_new_page(url, title) {
		var targetUrl = url;
		if (!title) {
			title = "";
		}
		if (window.BKBridge) {
			window.BKBridge.Call("new_page", {
					"url": targetUrl,
					"title": title
				},
				"");
		} else {
			window.location.href = url;
		}
	},
	/**
 * 认证完成后调用
 */
	bk_enterprise_authen_success () {
    var urlData = bk_getRequestData();
    var token = "";
    if(urlData && urlData.token){
        token = urlData.token;
    }
    if (window.BKBridge) {
        window.BKBridge.Call("bk_enterprise_authen_success", {token:token},"");
    } else {
        //window.location.href = url;
    }
}
}
